package com.lagou;

import com.lagou.service.UserServiceImpl;
import com.lagou.util.Configuration;
import org.I0Itec.zkclient.ZkClient;
import org.apache.zookeeper.data.Stat;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.beans.PropertyVetoException;

@SpringBootApplication
public class ServerBootstrap {
    public static void main(String[] args) throws InterruptedException, PropertyVetoException {
        SpringApplication.run(ServerBootstrap.class, args);

        UserServiceImpl.startServer("127.0.0.1",8991);
        UserServiceImpl.createHostToZookeeper();
        //保存数据库连接信息到zookeeper
        UserServiceImpl.saveDBInfoToZookeeper();
        Configuration.setDataSource();
    }
}
